#!/usr/bin/python
import util
import numpy


class Channel():
    def __init__(self, lower=-10, upper=10, limit=1000):
        self.noise_lower = lower
        self.noise_upper = upper
        self.noise_limit = limit
        pass
    def render(self, iq_data):
        output = []
        for i in iq_data:
            #print "self.lower %r, self.upper %r, self.limit %r"%(self.noise_lower, self.noise_upper, self.noise_limit)
            data_i = numpy.random.randint(self.noise_lower, self.noise_upper)/float(self.noise_limit)
            data_q = numpy.random.randint(self.noise_lower, self.noise_upper)/float(self.noise_limit)
            #print "data_i is %r, data_q is %r"%(data_i, data_q)
            noise = complex(data_i, data_q)
            #print "noise is %r"%noise
            output.append(i+noise)
        return output
